package com.wmyg.antifake.gs1.ns2.converters;

import com.wmyg.antifake.gs1.ns2.SpecialString;
import com.wmyg.antifake.gs1.ns2.basic.BrandNameInformation;
import org.dom4j.Element;

import java.util.List;

/**
 * @program: antifake
 * @description: 品牌名称转换器
 * @author: wong
 * @create: 19-4-23
 */
public class BrandNameConverter {

    protected static BrandNameInformation converter(Element element) {
        BrandNameInformation brandName = new BrandNameInformation();
        List<Element> children = element.elements();
        for (Element e :
                children) {
            switch (e.getName()) {
                case "brandName":
                    brandName.setBrandName(e.getText());
                    break;
                case "languageSpecificBrandName":
                    brandName.setLanguageSpecificBrandName(new SpecialString(e));
                    break;
                default:
            }
        }
        return brandName;
    }

}
